import request from "@/utils/request";
export function DeviceExportExcel(data) {
  return request({
    url: '/api/v1/DeviceExport/DeviceExportExcel',
    method: 'post',
    data,
  })
}

export function DeviceImport(data) {
  return request({
    url: '/api/v1/DeviceImport/DeviceImport',
    method: 'post',
    data
  })
}

export function create(data) {
  return request({
    url: '/api/v1/Device/Create',
    method: 'post',
    data
  })
}

export function deleteRecord(data) {
  return request({
    url: '/api/v1/Device/Delete',
    method: 'delete',
    data
  })
}

export function update(data) {
  return request({
    url: '/api/v1/Device/Update',
    method: 'post',
    data
  })
}

export function DeviceLabelSettingUpdate(data) {
  return request({
    url: '/api/v1/DeviceLabelSetting/Update',
    method: 'post',
    data
  })
}

export function GetDevice(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  return request({
    url: '/api/v1/Device/GetDevice',
    method: 'get',
    params: data
  })
}

export function getList(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  return request({
    url: '/api/v1/Device/GetList' +
      (data.statusNameList === undefined ? "" : data.statusNameList) +
      (data.notStatusNameList === undefined ? "" : data.notStatusNameList) +
      (data.idList === undefined ? "" : data.idList),
    method: 'get',
    params: data
  })
}

export function getDeviceNum() {
  return request({
    url: '/api/v1/Device/GetDeviceNum',
    method: 'get'
  })
}
export function deviceLedgerList(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  return request({
    url: '/api/v1/Device/deviceLedgerList',
    method: 'get',
    params: data
  })
}
export function getDepartIdList(data) {
  return request({
    url: '/api/v1/Device/GetDepartIdList',
    method: 'get',
    params: data
  })
}
export function getDepartTree(data) {
  return request({
    url: '/api/v1/PermissionDepartment/GetPermissionDepTree',
    method: 'get',
    params: data
  })
}
export function get(data) {
  return request({
    url: '/api/v1/Device/Get',
    method: 'get',
    params: data
  })
}
export function DeviceLabelSettingGet(data) {
  return request({
    url: '/api/v1/DeviceLabelSetting/Get',
    method: 'get',
    params: data
  })
}
// 导入设备数据
export const ImportDeviceUrl = data => request.post('/api/v1/Device/ExcelImport', data);
// 下载设备模板
export const DownloadDeviceTemplate = params => request('/api/v1/Device/DownloadDeviceTemplate', { params: params });
